package connectordemo;

import java.util.Comparator;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 苏李涛
 * Date: 2024-07-07
 * Time: 13:52
 */


/**
 * NameComparator类就是一个比较器
 */
public class NameComparator implements Comparator<Student> {
    @Override
    public int compare(Student o1, Student o2) {
        //String类型，本来就实现了Comparable接口，所有可以使用，Comparable接口里的，compareTo方法
        return o1.name.compareTo(o2.name);
    }
}
